home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16356 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: user1.mnsinc.com!huang
  2. From: huang@mnsinc.com (Szu-Wen Huang)
  3. Newsgroups: comp.lang.c++,comp.lang.c,comp.os.ms-windows.programmer.misc
  4. Subject: Re: fastest code
  5. Followup-To: comp.lang.c++,comp.lang.c,comp.os.ms-windows.programmer.misc
  6. Date: 10 Apr 1996 14:50:47 GMT
  7. Organization: Monumental Network Systems
  8. Message-ID: <4kghs7$250@news1.mnsinc.com>
  9. References: <316112A2.7D37@public.sta.net.cn> <4k4ll5$fq@solutions.solon.com> <4ke5v6$17k@samba.rahul.net> <1996Apr10.110121.6784@friend.kastle.com> <4kgbmj$j3j@solutions.solon.com>
  10. NNTP-Posting-Host: user.mnsinc.com
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Peter Seebach (seebs@solutions.solon.com) wrote:
  14. : In article <1996Apr10.110121.6784@friend.kastle.com>,
  15. : Richard Krehbiel <rich@kastle.com> wrote:
  16. : >Oliver Hellwig <hellwig@rahul.net> wrote:
  17. : >>         for (i=0; i<16; i++)
  18. : >>             prom[i] = prom[i+i];
  19.  
  20. : >>The output of the compiler left the loop but removed the 
  21. : >>assignment!
  22.  
  23. : >I suspect a proper "volatile" declaration on "prom" might have fixed
  24. : >this, i.e. if "prom" is currently declared "char prom[16]" then it
  25. : >should be declared "volatile char prom[16]".  I would not consider
  26. : >this an optimizer bug in Watcom.
  27.  
  28. : HUH?  the code as written has a clear effect, which is to shove all of
  29. : the elements of an array over one.  It certainly is an optimizer bug.
  30.  
  31. : Read the code carefully; the 2nd reference to prom[] uses a different
  32. : index into the array.  This is not a meaningless statement.
  33.  
  34. *You* read closely.  The second index is "i+i".  ;)  Okay, so it's a
  35. typo, but one who says "read carefully" is expected to.  Cheers.
  36.